<?php

putenv("DISPLAY=:1");
putenv("XAUTHORITY=/var/www/.Xauthority");


ini_set('display_errors', 1);
error_reporting(E_ALL);

include 'Bot.php';
include 'Api.php';

$userId = $_GET['testId'];
$issueId =  $_GET['issue'];

if (!$issueId || !$userId || !in_array($userId, array(78, 112, 83))) {
   return false;
}

$user = Bot::getInstance()->getUserByIdRedmine($userId);

if ($user) {
    $api = Api::factory('xml');
    $api->assignTo($issueId, $userId, $user['redmine_login']);
    header('Location: http://pm.vs58.net/issues/' . $issueId);
}
